import webapp2

routes = [
          webapp2.Route(r'/', handler='views.openpart.Index', name='open_mainpage'),
          webapp2.Route(r'/ams/', handler='views.mainpage.MainPage', name='mainpage'),
          
          # registration
          webapp2.Route(r'/registration/<command:\w+>/', handler='views.registration.Registration', name='registration'),
          
          webapp2.Route(r'/ams/immeuble/<imm_id:\d+>/<command:\w+>/', handler='views.immeubles.Immeuble', name='immeuble'),
          webapp2.Route(r'/ams/immeuble/<imm_id:\d+>/', handler='views.immeubles.ImmeubleDetails', name='immeuble_details'),
          webapp2.Route(r'/ams/immeubles/switch/<imm_id:\d+>/', handler='views.immeubles.Switch', name='immeuble_switch'),
         
          webapp2.Route(r'/ams/immeuble/<imm_id:\d+>/report/', handler='views.reports.MainReport', name='report_main'),
          
          # creation
          webapp2.Route(r'/ams/immeuble/<imm_id:\d+>/creation/lots/<command:\w+>/', handler='views.lots.Lots', name='creation_lots'),
          webapp2.Route(r'/ams/immeuble/<imm_id:\d+>/creation/lots/<command:\w+>/<lot_id:\d+>/', handler='views.lots.Lots', name='creation_lots_t'),
          
          webapp2.Route(r'/ams/immeuble/<imm_id:\d+>/creation/coowners/<command:\w+>/', handler='views.immeubles.CoOwners', name='creation_coowners'),
          
          webapp2.Route(r'/ams/immeuble/<imm_id:\d+>/creation/lotowners/<command:\w+>/', handler='views.lots.LotOwners', name='creation_lotowners'),
          webapp2.Route(r'/ams/immeuble/<imm_id:\d+>/creation/lotowners/<command:\w+>/<lo_id:\d+>/', handler='views.lots.LotOwners', name='creation_lotowners_t'),
          
          webapp2.Route(r'/ams/immeuble/<imm_id:\d+>/creation/council/<command:\w+>/', handler='views.immeubles.Council', name='creation_council'),
          webapp2.Route(r'/ams/immeuble/<imm_id:\d+>/creation/council/<command:\w+>/<cn_id:\d+>/', handler='views.immeubles.Council', name='creation_council_t'),
          
          webapp2.Route(r'/ams/immeuble/<imm_id:\d+>/creation/cles_de_repartition/<command:\w+>/', handler='views.tantieme.Tantieme', name='creation_cles_de_repartition'),
          webapp2.Route(r'/ams/immeuble/<imm_id:\d+>/creation/cles_de_repartition/<command:\w+>/<t_id:.+>/', handler='views.tantieme.Tantieme', name='creation_cles_de_repartition_t'),
          
          webapp2.Route(r'/ams/immeuble/<imm_id:\d+>/creation/banque/<command:\w+>/', handler='views.bank_account.BankAccount', name='creation_banque'),
          webapp2.Route(r'/ams/immeuble/<imm_id:\d+>/creation/banque/<command:\w+>/<ba_id>/', handler='views.bank_account.BankAccount', name='creation_banque_b'),
          
          webapp2.Route(r'/ams/immeuble/<imm_id:\d+>/creation/budget/<command:\w+>/', handler='views.budget_item.BudgetItem', name='creation_budget'),
          webapp2.Route(r'/ams/immeuble/<imm_id:\d+>/creation/budget/<command:\w+>/<bi_id:\d+>/', handler='views.budget_item.BudgetItem', name='creation_budget_b'),
          
          # parametrage
          webapp2.Route(r'/ams/immeuble/<imm_id:\d+>/parametrage/plan_comptable/<command:\w+>/', handler='views.accounts.Accounts', name='parametrage_account'),
          webapp2.Route(r'/ams/immeuble/<imm_id:\d+>/parametrage/plan_comptable/<command:\w+>/<acc_id>/', handler='views.accounts.Accounts', name='parametrage_account_a'),
          
          webapp2.Route(r'/ams/immeuble/<imm_id:\d+>/parametrage/cles/<command:\w+>/', handler='views.charges.ChargesKeys', name='parametrage_cles'),
          webapp2.Route(r'/ams/immeuble/<imm_id:\d+>/parametrage/cles/<command:\w+>/<ck_id:.+>/', handler='views.charges.ChargesKeys', name='parametrage_cles_c'),
          
          webapp2.Route(r'/ams/immeuble/<imm_id:\d+>/parametrage/type_de_lot/<command:\w+>/', handler='views.lot_type.LotTypes', name='parametrage_type_de_lot'),
          webapp2.Route(r'/ams/immeuble/<imm_id:\d+>/parametrage/type_de_lot/<command:\w+>/<lt_id:\d+>/', handler='views.lot_type.LotTypes', name='parametrage_type_de_lot_l'),
          
          webapp2.Route(r'/ams/immeuble/<imm_id:\d+>/parametrage/type_de_nature_des_depenses/<command:\w+>/', handler='views.exp_type.ExpTypes', name='parametrage_type_de_nature_des_depenses'),
          webapp2.Route(r'/ams/immeuble/<imm_id:\d+>/parametrage/type_de_nature_des_depenses/<command:\w+>/<et_id:.+>/', handler='views.exp_type.ExpTypes', name='parametrage_type_de_nature_des_depenses_l'),
          
          webapp2.Route(r'/ams/immeuble/<imm_id:\d+>/parametrage/nature_des_depenses/<command:\w+>/', handler='views.expenditures.Expenditures', name='parametrage_nature_des_depenses'),
          webapp2.Route(r'/ams/immeuble/<imm_id:\d+>/parametrage/nature_des_depenses/<command:\w+>/<exp_id:\w+>/', handler='views.expenditures.Expenditures', name='parametrage_nature_des_depenses_t'),
          
          webapp2.Route(r'/ams/immeuble/<imm_id:\d+>/parametrage/period_concept/<command:\w+>/', handler='views.period_concept.PeriodConcept', name='period_concept'),
          webapp2.Route(r'/ams/immeuble/<imm_id:\d+>/parametrage/period_concept/<command:\w+>/<pc_id:\w+>/', handler='views.period_concept.PeriodConcept', name='period_concept_t'),
          
          # vie
          webapp2.Route(r'/ams/immeuble/<imm_id:\d+>/vie/liste_des_furnisseurs/<command:\w+>/', handler='views.supplier.Suppliers', name='vie_suppliers'),
          webapp2.Route(r'/ams/immeuble/<imm_id:\d+>/vie/liste_des_furnisseurs/<command:\w+>/<s_id:\d+>/', handler='views.supplier.Suppliers', name='vie_suppliers_t'),
          
          webapp2.Route(r'/ams/immeuble/<imm_id:\d+>/vie/contacts/<command:\w+>/', handler='views.contact.Contacts', name='vie_contacts'),
          webapp2.Route(r'/ams/immeuble/<imm_id:\d+>/vie/contacts/<command:\w+>/<c_id:\d+>/', handler='views.contact.Contacts', name='vie_contacts_t'),
          
          webapp2.Route(r'/ams/immeuble/<imm_id:\d+>/vie/work_types/<command:\w+>/', handler='views.work_type.WorkTypes', name='vie_work_types'),
          webapp2.Route(r'/ams/immeuble/<imm_id:\d+>/vie/work_types/<command:\w+>/<t_id:\d+>/', handler='views.work_type.WorkTypes', name='vie_work_types_t'),
          
          webapp2.Route(r'/ams/immeuble/<imm_id:\d+>/vie/reception_facture/<command:\w+>/', handler='views.invoice.Invoices', name='vie_invoice'),
          webapp2.Route(r'/ams/immeuble/<imm_id:\d+>/vie/reception_facture/<command:\w+>/<inv_id:\d+>/', handler='views.invoice.Invoices', name='vie_invoice_t'),
          
          webapp2.Route(r'/ams/immeuble/<imm_id:\d+>/vie/paiement/<command:\w+>/', handler='views.payment.Payments', name='vie_payments'),
          webapp2.Route(r'/ams/immeuble/<imm_id:\d+>/vie/paiement/<command:\w+>/<inv_id:\d+>/', handler='views.payment.Payments', name='vie_payments_t'),
          
          webapp2.Route(r'/ams/immeuble/<imm_id:\d+>/vie/encaissements_proprietaires/<command:\w+>/', handler='views.coowner_payment.CoownerPayments', name='vie_coowner_payments'),
          webapp2.Route(r'/ams/immeuble/<imm_id:\d+>/vie/encaissements_proprietaires/<command:\w+>/<cp_id>/', handler='views.coowner_payment.CoownerPayments', name='vie_coowner_payments_t'),
          
          webapp2.Route(r'/ams/immeuble/<imm_id:\d+>/vie/fundraising/<command:\w+>/', handler='views.fundraising.FundRaising', name='fundraising'),
          webapp2.Route(r'/ams/immeuble/<imm_id:\d+>/vie/fundraising/<command:\w+>/<fr_id:\d+>/', handler='views.fundraising.FundRaising', name='fundraising_t'),
          
          webapp2.Route(r'/ams/immeuble/<imm_id:\d+>/vie/diverse_operations/<command:\w+>/', handler='views.diverse_operations.DiverseOperations', name='diverse_operations'),
          webapp2.Route(r'/ams/immeuble/<imm_id:\d+>/vie/diverse_operations/<command:\w+>/<do_id:\d+>/', handler='views.diverse_operations.DiverseOperations', name='diverse_operations_t'),

          webapp2.Route(r'/ams/immeuble/<imm_id:\d+>/vie/grand_livre/<command:\w+>/', handler='views.general_ledger.GeneralLedger', name='vie_general_ledger'),
          webapp2.Route(r'/ams/immeuble/<imm_id:\d+>/vie/grand_livre/<command:\w+>/<rec_key>/', handler='views.general_ledger.GeneralLedger', name='vie_general_ledger_t'),
          
          # syndic
          webapp2.Route(r'/ams/immeuble/<imm_id:\d+>/syndic/syndic/<command:\w+>/', handler='views.syndic.Syndics', name='syndic'),
          webapp2.Route(r'/ams/immeuble/<imm_id:\d+>/syndic/syndic/<command:\w+>/<s_id:\d+>/', handler='views.syndic.Syndics', name='syndic_t'),
          
          webapp2.Route(r'/ams/immeuble/<imm_id:\d+>/syndic/users/<command:\w+>/', handler='views.userspy.Users', name='users'),
          webapp2.Route(r'/ams/immeuble/<imm_id:\d+>/syndic/users/<command:\w+>/<u_id>/', handler='views.userspy.Users', name='users_t'),
          
          # reports
          webapp2.Route(r'/ams/immeuble/<imm_id:\d+>/report/<command:\w+>/', handler='views.reports.MainReport', name='report'),
          webapp2.Route(r'/ams/immeuble/<imm_id:\d+>/report/<command:\w+>/<p_id:\d+>/', handler='views.reports.MainReport', name='report_t'),
          
          webapp2.Route(r'/ams/immeuble/<imm_id:\d+>/report_web/<command:\w+>/', handler='views.reports_web.ReportsWeb', name='reports_web'),
          webapp2.Route(r'/ams/immeuble/<imm_id:\d+>/report_web/<command:\w+>/<ap_id:\d+>/', handler='views.reports_web.ReportsWeb', name='reports_web_ap'),
          ]

config = {}
config['webapp2_extras.sessions'] = {'secret_key': 'SNSDFAIOPKNASDF0NNKASDF77JNASKNDF787BADF', }

app = webapp2.WSGIApplication(routes=routes, debug=True, config=config)
